<?php

namespace app\mobile\controller;

class Massage extends base
{

//
//    public function index()
//    {
//        $list = $this->obj->order('create_time DESC,id DESC')->paginate(2);
//        $listnav = $this->obj->limit(6)->select();
//        $data = $this->obj->find($this->request->param('id'));
//        $next = $this->obj->getnext($data->id);
//        $this->assign([
//            'listnav' => $listnav,
//            'list' => $list,
//            'data' => $data,
//            'next' => $next,
//        ]);
//        return $this->fetch();
//    }


    /**
     *提交留言
     */
    public function save()
    {
        if ($this->request->isPost()) {

            $data = $this->request->post();
            $result = $this->validate($data, 'Massage');
            if (true !== $result) {
                return ajax_info($result);
            }
            $res = model('Massage')->allowField(true)->save($data);
            if ($res) {
                return ajax_info('留言成功，等待审核！','y');
            } else {
                return ajax_info('留言失败！');
            }

        }

    }

}
